#include "oled_device.h"
#include "driver_i2c.h"
#include "driver_oled.h"
#include <string.h>


static int OledDeviceInit(struct DisplayDevice *displayDev)
{
	I2C_GPIO_ReInit();
    OLED_Init();   
    return PDSUCCESS;
}


static int OledDeviceClear(struct DisplayDevice *displayDev)
{
	OLED_Clear();  
    return PDSUCCESS;
}


static int OledDeviceDisplay(struct DisplayDevice *displayDev, uint8_t page, uint8_t col, char *str)
{
	OLED_PrintString(page, col, str);
    return PDSUCCESS;
}

static displayDevice oled = {
	.name = "OLED",
	.Init = OledDeviceInit,
    .Clear = OledDeviceClear, 
    .Display = OledDeviceDisplay
};


pDisplayDevice GetOLEDDevice(char *name)
{
    if(strcmp(name, "OLED") == 0)
    {
        return &oled;
    }
    return NULL;
}

